home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / (A)TA / (A)TAL.ADF / Basic_Progs / Star_Trek (.txt) < prev    next >
AmigaBASIC Source Code  |  1986-11-06  |  22KB  |  602 lines

  1.  
  2. 'Super Star Trek' May 16,1978, adapted to `AMY' Dec 16, 1987
  3.  '  by    Bill Elliott. Box 377,
  4. '        Port Dover Ontario, N0A 1N0
  5.  'Phone (519) 583-2525
  6.  
  7. GOSUB setscreen:GOTO titlestrip
  8.  
  9. 'Colour combinations courtesy John Bos (BAUG):
  10.  
  11.  
  12.  setscreen:
  13.  
  14.  
  15.      rgb 0,9,9,9 'paper
  16.      rgb 1,0,0,0 'pen
  17.      rgb 2,13,0,0 'field
  18.      rgb 3,15,15,0 'highlight
  19.      
  20.  
  21.  SUB rgb(n%,r%,g%,b%) STATIC
  22.   PALETTE n%,r%/16,g%/16,b%/16
  23.   
  24.   END SUB
  25.   
  26.  
  27. PRINT :PRINT :PRINT :PRINT :PRINT :PRINT :PRINT :PRINT :PRINT :PRINT :PRINT 
  28.        DIM g(8,8),c(9,2),k(3,3),n(3),z(8,8),d(8)
  29.  
  30. titlestrip:RESTORE:GOSUB speech
  31.  
  32.  
  33. PRINT "                                    ,------*------,"
  34. PRINT "                  ,--------------   `---  --------'"
  35. PRINT "                  `--------   ---'     / /   "
  36. PRINT "                       ,---' `------- / /--, "
  37. PRINT "                       `-------------------' "
  38. PRINT "                    The USS Enterprise---NCC-1701"
  39. PRINT :PRINT :PRINT :PRINT :PRINT :GOSUB sayone
  40.  
  41.  RANDOMIZE TIMER   
  42.          z$ = "                         "
  43.        
  44.        
  45.                     
  46.  t = INT (RND*20+20)*100:t0 = t:t9 = 25+INT (RND*10):d0 = 0:e = 3000:e0 = e
  47.        
  48.         p=10:p0=p:s9=200:s=0:b9=0:k9=0:x$="":x0$=" is "
  49.  
  50. 470 DEF FN d(i) = SQR((k(i,1)-s1)^2+(k(i.2)-s2)^2)
  51.  
  52. 475 DEF FN r(i) = INT(RND*7.98+ 1.01)
  53.  
  54.  ' Initialize Enterprise's position
  55.  
  56. 490 q1 = FNr(1): q2 = FNr(1): s1 = FNr(1): s2 = FNr(1)
  57.       FOR i = 1 TO 9: c(i,1) = 0: c(i,2) = 0 :NEXT i
  58.       c(3,1) = -1: c(2,1) = -1: c(4,1) = -1: c(4,2) = -1: c(5,2)= -1:c(6,2)= -1
  59. 600 c(1,2) = 1: c(2,2) = 1: c(6,1) = 1: c(7,1) =1: c(8,1) =1: c(8,2) =1: c(9,2) =1
  60. 670 FOR i = 1 TO 8: d(i) =0: NEXT i
  61.       
  62.       a1$ ="navsrslrsphatorshedamcomxxx"
  63.       
  64.  ' Set up what exists in the galaxy...
  65.  
  66.  ' k3 = # Klingons b3 = # Starbases s3 = Stars
  67.  
  68. 820 FOR i = 1 TO 8: FOR j = 1 TO 8: k3 = 0: z(i,j) = 0:r1= RND
  69.       IF r1 >0.98 THEN k3 = 3: k9 = k9+ 3: GOTO 980
  70.       IF r1 >0.95 THEN k3 = 2: k9 = k9 + 2: GOTO 980
  71.       IF r1 >0.8 THEN k3 = 1: k9 = k9+ 1
  72. 980 b3 = 0: IF RND>0.96 THEN b3 = 1: b9 =b9 +1
  73.       g(i,j) = k3*100+b3*10+FNr(1):NEXT j:NEXT i:IF k9>t9 THEN t9=k9+1
  74.       IF b9<>0 THEN 1200
  75.       IF g(q1,q2)<200 THEN g(q1,q2) = g(q1,q2) + 100: k9 = k9 + 1
  76.       b9 = 1: g(q1,q2)= g(q1,q2)+ 10: q1 =FNr(1):q2 = FNr(1)
  77. 1200 k7= k9:IF b9<> 1 THEN x$ = "s": x0$= " are"
  78.     PRINT " Your orders are as follows:"
  79.     PRINT "    Destroy the";k9;"Klingon warships which have invaded the "
  80.     PRINT " Galaxy before they can attack Federation Headquarters"
  81.     PRINT " on Stardate";t0+t9;" This gives you";t9;"days. There";x0$
  82.     PRINT "  ";b9;"Starbase";x$;" in the Galaxy for resupplying your ship."
  83.     PRINT 
  84. 1299 INPUT  " Hit an `r' and then RETURN when ready to accept command.";r$  
  85. 1300 IF r$<>"r" THEN 1299
  86.  
  87.   'Here any time new quadrant entered
  88.  
  89.  
  90. 1320 z4= q1: z5= q2: k3= 0: b3= 0: s3= 0: g5= 0: d4= 0.5* RND: z(q1,q2)= g(q1,q2)
  91.      IF q1< 1 OR q1>8 OR q2< 1 OR q2> 8 THEN 1600
  92.     GOSUB 9030:PRINT :IF t0<> t THEN 1490
  93.   PRINT "  Your mission begins with your Starship located"
  94.   PRINT " in the Galactic Quadrant, `";g2$;"'.": GOTO 1500
  95. 1490 PRINT "  Now entering  ";g2$;" Quadrant. . ." 
  96. 1500 PRINT : k3= INT(g(q1,q2)*0.01): b3= INT(g(q1,q2)*0.1)-10*k3
  97.       s3= g(q1,q2)- 100*k3 - 10*b3: IF k3 = 0 THEN 1590
  98.      PRINT " Combat area    Condition Red": IF s>200 THEN 1590
  99.      PRINT " Shields dangerously low!!!"
  100. 1590 FOR i = 1 TO 3 : k(i,1)=0: k(i,2)= 0: NEXT i
  101. 1600 FOR i = 1 TO 3: k(i,3)=0:NEXT i:q$=z$+z$+z$+z$+z$+z$+z$+ LEFT$(z$,17)
  102.       'Position of Enterprise in Quadrant then place K3 Klingons in
  103.       'Quadrant & B3 Starbases and S3 stars elsewhere.
  104. 1680 a$= "<*>":z1=s1:z2=s2: GOSUB 8670: IF k3<1 THEN 1820
  105. 1720 FOR i = 1 TO k3: GOSUB 8590: a$ = "+K+": z1=r1: z2=r2
  106.  
  107. 1780 GOSUB  8670: k(i,1)=r1: k(i,2)=r2: k(i,3)=s9*(0.5+ RND):NEXT i
  108. 1820 IF b3 < 1 THEN 1910
  109. 1880 GOSUB 8590: a$ = ">!<": z1= r1: b4= r1: z2= r2:b5= r2: GOSUB 8670
  110. 1910 FOR i = 1 TO s3: GOSUB 8590: a$= " * ": z1= r1: z2= r2: GOSUB 8670: NEXT i
  111. 1980 GOSUB 6430
  112. 1990 IF s + e>10 THEN IF e>10 OR d(7)= 0 THEN 2060
  113.      PRINT :PRINT " ** Fatal Error **  You've just stranded your ship in"
  114.      PRINT " Space:?" You have insufficient maneuvering energy,";
  115.      PRINT " and Shield control":PRINT " Presently incapable of cross";
  116.      PRINT "-circuiting to Engine Room!!": GOTO 6220
  117. 2060 INPUT " Command";a$
  118.      FOR i = 1 TO 9: IF LEFT$ (a$,3)<> MID$(a1$,3*i-2,3) THEN 2160
  119.     ON i GOTO 2300,1980,4000,4260,4700,5530,5690,7290,6270
  120. 2160 NEXT i:PRINT " Enter one of the following:"
  121.     PRINT "  nav...to set course
  122.     PRINT "  srs...for short range sensor scan            3
  123.     PRINT "  lrs...for long range sensor scan           4 | 2
  124.     PRINT "  pha...to fire phasers                     5--|--1
  125.     PRINT "  tor...to fire photon torpedoes             6 | 8
  126.     PRINT "  she...to raise or lower shields              7
  127.     PRINT "  dam...for damage control reports
  128.     PRINT "  com...to call on library-computer
  129.     PRINT "  xxx...to resign your command":GOTO 1990
  130.   'Course Control begins here...
  131.     
  132. 2300 INPUT " Course (0-9)";c1:IF c1=9 THEN c1=1
  133.       IF c1 >=1 AND c1<9 THEN 2350
  134. WINDOW OUTPUT 1: PRINT "   Lt. Sulu reports, `Incorrect course data Sir!!": GOTO 1990
  135. 2350 WINDOW OUTPUT 1:x$= "8": IF d(1)<0 THEN x$= "0.2"
  136. 2360 PRINT " Warp Factor (0-";x$;")";:INPUT w1:IF d(1)<0 AND w1>0.2 THEN 2470
  137.       IF w1 >0 AND w1 <=8 THEN 2490
  138.       IF w1 = 0 THEN 1990
  139.      PRINT " Chief Engineer Scott reports `The engines won't take";
  140.      PRINT "Warp ";w1;'": GOTO 1990
  141. 2470 PRINT " Warp engines are damaged. Maximum speed = Warp 0.2":GOTO 1990
  142. 2490 n= INT(w1*8+0.5): IF e-n>= 0 THEN 2590
  143.      PRINT " Engineering reports `Insufficient Energy available"
  144.      PRINT "                      for maneuvering at Warp";w1;"!'"
  145.       IF s <n- e OR d(7)< 0 THEN 1990
  146.      PRINT " Deflector Control Room acknowledges";s;"units of Energy"
  147.      PRINT "                         presently deployed to Shields."
  148.         GOTO 1990
  149.    'Klingons move/fire on moving Starship. . .
  150. 2590 FOR i = 1 TO k3: IF k(i,3) = 0 THEN 2700
  151.         a$= "   ": z1= k(i,1): z2= k(i,2): GOSUB 8670:GOSUB 8590
  152. 2660 k(i,1)=z1:k(i,2)=z2:a$="+K+": GOSUB 8670
  153.  2700 NEXT i: GOSUB 6000: d1= 0: d6= w1: IF w1 >= 1 THEN d6 = 1
  154.       FOR i= 1 TO 8: IF d(i)>=0 THEN 2880
  155.       d(i) = d(i) +d6: IF d(i)> -0.1 AND d(i) <0 THEN d(1) = -0.1:GOTO 2880
  156.       IF d(i) <0 THEN 2880
  157.       IF d1 <> 1 THEN d1 = 1: PRINT " Damage Control Report: ";
  158.       PRINT TAB(8);:r1=i:GOSUB 8790:PRINT g2$;" Repair completed."
  159. 2880 NEXT i: IF RND>0.2 THEN 3070
  160.       r1 = FNr(1): IF RND>= 0.6 THEN 3000
  161.       d(r1) = d(r1)-(RND*5+1): PRINT " Damage Control Report:  ";
  162.       GOSUB 8790:PRINT g2$;" Damaged":PRINT :GOTO 3070
  163. 3000 d(r1)=d(r1)+RND*3+1:PRINT " Damage Control Report:  ";
  164.       GOSUB 8790: PRINT g2$;" State of repair improved":PRINT 
  165.   ' Begin moving Starship
  166. 3070 a$= "   ": z1=INT(s1):z2=INT(s2):GOSUB 8670
  167. 3110 x1=c(c1,1)+(c(c1+1,1)-c(c1,1))*(c1-INT(c1)):x=s1:y=s2
  168. 3140 x2=c(c1,2)+(c(c1+1,2)-c(c1,2))*(c1-INT(c1)):q4=q1:q5=q2
  169. 3170 FOR i = 1 TO n:s1=s1+x1: s2=s2+x2:IF s1<1 OR s1>=9 OR s2<1 OR s2>=9 THEN 3500
  170. 3240 s8 = INT(s1)*24 + INT (s2)*3-26: IF MID$(q$,s8,2)= "  " THEN 3360
  171. 3320 s1 = INT(s1-x1): s2 = INT(s2-x2):PRINT " Warp Engines shut down at ";
  172.       PRINT " Sector";s1;",";s2;" due to bad Navigation.":GOTO 3370
  173. 3360 NEXT i: s1 = INT(s1):s2= INT (s2)
  174. 3370 a$= "<*>": z1=INT(s1): z2=INT(s2): GOSUB 8670:GOSUB 3910:t8=1
  175. 3430 IF w1 <1 THEN t8= 0.1*INT (10*w1)
  176.        t=t+t8: IF t> t0+t9 THEN 6220
  177.    'See if docked then get command
  178.        GOTO 1980
  179.    ' Exceded Quadrant Limits
  180. 3500 x = 8*q1+x+n*x1: y= 8*q2+y+n*x2: q1= INT(x/8):q2=INT(y/8): s1= INT(x-q1*8)
  181.         s2 = INT(y-q2*8): IF s1=0 THEN q1=q1-1: s1=8
  182.         IF s2 = 0 THEN q2=q2-1: s2=8
  183.         x5=0:IF q1<1 THEN x5=1: q1=1: s1=1
  184.         IF q1>8 THEN x5=1:q1=8:s1=8
  185.         IF q2<1 THEN x5=1:q2=1:s2=1
  186.         IF q2>8 THEN x5=1:q2=8:s2=8
  187.         IF x5=0 THEN 3860
  188.       PRINT " Lt. Uhura reports message from Starfleet Command:"
  189.       PRINT " `Permission to attempt crossing of Galactic Perimeter
  190.       PRINT " is hereby * denied *. Shut down your engines.'" 
  191.       PRINT "   Chief Engineer Scott reports `Warp Engines shut down'"
  192.       PRINT " at Sector";s1;",";s2;"of Quadrant";q1;",";q2;".'"
  193.         IF t>t0+t9 THEN 6220
  194. 3860 IF 8*q1+q2= 8*q4+q5 THEN 3370
  195.       t=t+1: GOSUB 3910:GOTO 1320
  196.   ' Maneuvre energy s/r **
  197.  3910 e=e-n-10: IF e>= 0 THEN RETURN
  198.       PRINT " Shield Control supplies energy to complete the  maneuvre."
  199.       s=s+e: e=0: IF s<=0 THEN s=0
  200.      RETURN
  201.      
  202.   ' Long Range Sensor Scan Code
  203.   
  204. 4000 IF d(3) <0 THEN PRINT " Long Range Sensors are inoperable.": GOTO 1990
  205.      PRINT " Long Range Scan for Quadrant";q1;",";q2
  206.       o1$ ="-------------------":PRINT o1$  
  207.      FOR i=q1-1 TO q1+1:n(1)=-1:n(2)=-2:n(3)=-3: FOR j= q2-1 TO q2+1
  208.      IF i>0 AND i<9 AND j>0 AND j<9 THEN n(j-q2+2)= g(i,j): z(i,j) = g(i,j)
  209.     NEXT j: FOR l = 1 TO 3:PRINT ": ";:IF n(l)<0 THEN PRINT "*** ";:GOTO 4230
  210.      PRINT  RIGHT$(STR$(n(l)+1000),3);" ";
  211. 4230 NEXT l: PRINT ":":PRINT o1$:NEXT i:GOTO 1990
  212.     
  213.  ' Phaser Control Code begins here
  214.  
  215. 4260 IF d(4) <0 THEN PRINT " Phasers Inoperative": GOTO 1990
  216.      IF k3 >0 THEN 4330
  217. 4270 PRINT "   Science Officer Spock reports `Sensors show no enemy ships"
  218.     PRINT "                                  in this Quadrant'":GOTO 1990
  219. 4330 IF d(8)<0 THEN PRINT " Computer failure hampers accuracy."
  220. 4350 PRINT " Phasers locked on target;  ";
  221. 4360 PRINT " Energy available =";e;"units"
  222.    INPUT"Number of units to fire";x: IF x<=0 THEN 1990
  223.      IF e-x <0 THEN 4360
  224.      e = e-x: IF d(7)<0 THEN x=x*RND
  225. 4450 h1 =INT(x/k3): FOR i = 1 TO 3: IF k(i,3)<=0 THEN 4670
  226. 4480 h = INT((h1/RND(0))*(RND(1)+2)):IF h>0.15*k(i,3) THEN 4530
  227.     PRINT " Sensors show no damage to enemy at ";k(i,1);",";k(i,2): GOTO 4670
  228.  4530 k(i,3)=k(i,3)-h:PRINT  h;" Unit hit on Klingon at Sector";k(i,1);",";k(i,2)
  229.      IF k(1,3)<=0 THEN PRINT "*** Klingon Destroyed ***":GOTO 4580
  230.      PRINT "    (Sensors show";k(i,3);"Units remaining)":GOTO 4670
  231. 4580 k3=k3-1: k9=k9-1: z1=k(i,1): z2=k(i,2): a$="   ": GOSUB 8670
  232.      k(i,3)=0: g(q1,q2)=g(q1,q2)-100: z(q1,q2)=g(q1,q2): IF k9<=0 THEN 6370
  233.      
  234. 4670 NEXT i:GOSUB 6000: GOTO 1990
  235.    ' Photon Torpedo Code begins here...
  236.    
  237.      
  238. 4700 IF p<=0 THEN PRINT " All Photon Torpedoes expended": GOTO 1990
  239.      IF d(5)<0 THEN PRINT " Photon tubes are not operational": GOTO 1990
  240.  
  241. 4760 INPUT " Photon torpedo course (1-9)";c1: IF c1 = 9 THEN c1=1
  242.      IF c1 >=1 AND c1 <=9 THEN 4850
  243.     PRINT " Ensign Chekov reports, `Incorrect course data Sir!'"
  244.     GOTO 1990
  245. 4850 x1= c(c1,1)+(c(c1+1,1)-c(c1,1))*(c1-INT(c1)): e=e-2:p=p-1
  246. 4860 x2= c(c1,2)+(c(c1+1,2)-c(c1,2))*(c1-INT(c1)): x=s1: y=s2
  247.    PRINT " Torpedo track:"
  248. 4920 x=x+x1: y=y+x2: x3 = INT(x+0.5): y3= INT(y+0.5)
  249.       IF x3<1 OR x3>8 OR y3<1 OR y3>8 THEN 5490
  250. 5000 PRINT "                ";x3",";y3: a$="   ": z1=x: z2=y: GOSUB 8830
  251.       IF z3<>0 THEN 4920
  252.      a$= "+K+": z1= x: z2= y: GOSUB 8830: IF z3= 0 THEN 5210
  253.     PRINT "  *** Klingon Destroyed ***":k3= k3-1: k9=k9-1: IF k9 <=0 THEN 6370
  254.      FOR i = 1 TO 3: IF x3= k(i,1) AND y3 = k(i,2) THEN 5190
  255.      NEXT i: i=3
  256. 5190 k(i,3)=0: GOTO 5430
  257.      
  258. 5210 a$=" * ": z1=x: z2=y: GOSUB 8830: IF z3=0 THEN 5280
  259.     PRINT " Star at";x3;",";y3;"absorbed Torpedo energy." :GOSUB 6000: GOTO 1990
  260.     
  261. 5280 a$= ">!<": z1=x: z2=y: GOSUB 8830:IF z3 = 0 THEN 4760 
  262.  
  263. 5330 PRINT " *** Starbase Destroyed ***": b3=b3-1: b9=b9-1
  264.      IF b9>0 OR k9>t-t0-t9 THEN 5400
  265. GOSUB saysix:PRINT " That does it Captain!!  You are hereby relieved of Command"
  266.      PRINT "and sentenced to 99 Stardates at Hard Labour on Cygnus 12!!"
  267.        GOTO 6270
  268.        
  269. 5400 GOSUB sayseven: PRINT "  Starfleet Command reviewing your record to consider"
  270.      PRINT " Court Martial!": d0=0
  271. 5430 z1=x: z2=y: a$="   ": GOSUB 8670
  272.       g(q1,q2)= k3*100+b3*10+s3: z(q1,q2)=g(q1,q2): GOSUB 6000: GOTO 1990
  273. 5490 PRINT "  Torpedo missed": GOSUB 6000: GOTO 1990
  274.  
  275.    'Shield Control
  276.    
  277. 5530 IF d(7)<0 THEN PRINT "  Shield Control Inoperable": GOTO 1990
  278.      PRINT "   Energy available =";e+s;: INPUT "Number of Units to Shields";x
  279.      IF x <=0 OR s=x THEN PRINT "  <Shields unchanged>": GOTO 1990
  280.      IF x <=e THEN 5630
  281.     PRINT "  Shield Control Reports ` This is not the Federation Treasury.'"
  282.     PRINT " <Shields Unchanged>": GOTO 1990
  283. 5630 e=e+s-x: s=x: PRINT "  Deflector Control Room Report:"
  284.      PRINT "    `Shields now at";INT(s);"units per your command.'": GOTO 1990
  285.      
  286.    'Damage Control
  287.    
  288. 5690 IF d(6) >=0 THEN 5910
  289. 5700 PRINT "  Damage Control Report not available": IF d0=0 THEN 1990
  290. 5720 d3=0: FOR i = 1 TO 8: IF d(i) <0 THEN d3=d3+0.1
  291.       NEXT i: IF d3=0 THEN 1990
  292.       PRINT : d3=d3+d4: IF d3>=1 THEN d3=0.9
  293. 5810 PRINT "  Technicians standing by to effect repairs to your ship;"
  294.       PRINT " Estimated time to repair:";0.01*INT(100 *d3);"Stardates"
  295.      INPUT " Will you authorize the repair order (y/n)";a$
  296.       IF a$ <> "y" THEN 1990
  297.      FOR i = 1 TO 8: IF d(i)<0 THEN d(i) = 0
  298.       NEXT i: t = t+d3+0.1
  299. 5910 PRINT :PRINT "  Device              State of Repair": FOR r1= 1 TO 8
  300.     GOSUB 8790: PRINT g2$;LEFT$(z$,25-LEN(g2$)); INT(d(r1)*100)*0.01
  301.       NEXT r1: PRINT : IF d0<>0 THEN 5720
  302.      GOTO 1990
  303.      
  304.   ' Klingons Shooting   
  305.      
  306. 6000 IF k3<=0 THEN RETURN
  307.      IF d0<>0 THEN PRINT "  Starbase Shields protect the Enterprise": RETURN
  308.      FOR i = 1 TO 3: IF k(i,3)<=0 THEN 6200
  309. 6060 h=INT((k(i,3)/RND(1))*(0.02+RND(1))): s=s-h: k(i,3)=k(i,3)/(3+RND(0))
  310.     PRINT   h;"Unit hit on Enterprise from Sector";k(i,1);",";k(i,2)
  311.      IF s<=0 THEN 6240
  312.     PRINT "  <Shields down to";s;"units>": IF h<20 THEN 6200
  313.      IF RND >0.6 OR h/s <=0.02 THEN 6200
  314.      r1 = FNr(1): d(r1)=d(r1)-h/s-0.5*RND: GOSUB 8790
  315.      PRINT "  Damage control reports `";g2$;" damaged by the hit'"
  316. 6200 NEXT i: RETURN
  317.  
  318.    ' End of Game
  319.    
  320.  
  321. 6220 PRINT "  It is Stardate";t: GOTO 6270
  322.  
  323. 6240 PRINT :GOSUB sayfive: PRINT "  The Enterprise has been destroyed. The Federation ";
  324.      PRINT " will be conquered": GOTO 6220
  325.      
  326. 6270 PRINT "  There were:";k9;"Klingon Battle Cruisers left at"
  327.      PRINT " the end of your mission."
  328. 6290 PRINT :PRINT 
  329.      GOSUB saytwo
  330.      PRINT "  The Federation is in need of another Starship Commander"
  331.      PRINT " for a similar mission -- If there is a volunteer,"
  332.     INPUT" let him step forward and enter `aye'";a$: IF a$ = "aye" THEN GOTO titlestrip
  333.     
  334.     
  335.     
  336. 6360 END
  337. 6370 GOSUB saythree:PRINT "  Congratulations, Captain! The last Klingon Battle Cruiser"
  338.      PRINT " menacing the Federation has been destroyed.":PRINT 
  339.      PRINT "  Your efficiency rating is";1000*(k7/(t-t0))^2: GOTO 6290
  340.      
  341.   'Short Range Sensor Scan & Startup Subroutine
  342.      
  343. 6430 FOR i=s1-1 TO s1+1: FOR j=s2-1 TO s2+1
  344. 6450 IF INT(i+0.5)<1 OR INT(i+0.5)>8 OR INT(j+0.5)<1 OR INT(j+0.5)>8 THEN 6540
  345.  
  346. 6490 a$= ">!<": z1=i: z2=j: GOSUB 8830: IF z3=1 THEN 6580  
  347.  
  348. 6540 NEXT j: NEXT i: d0=0: GOTO 6650
  349. 6580 d0=1:c$="docked": e=e0: p=p0
  350. 6620 PRINT "  Shields dropped for docking purposes": s=0: GOTO 6720
  351. 6650 IF k3>0 THEN c$="*red*":GOTO 6720    
  352.      c$= "green": IF fe<e0*0.1 THEN c$ = "yellow"
  353.  
  354. 6720 IF d(2)>=0 THEN 6770
  355.      PRINT :PRINT "  *** Short Range Sensors Are Out ***":PRINT :RETURN
  356.      
  357.  
  358.  
  359. 6770 o1$= "---------------------------------":PRINT  o1$: FOR i = 1 TO 8
  360.  
  361. 6820 FOR j=(i-1)*24+1 TO (i-1)*24+22 STEP 3:PRINT " "; MID$(q$,j,3);: NEXT j
  362. 6830 ON i GOTO 6850,6900,6960,7020,7070,7120,7180,7240
  363. 6850 PRINT "    3     Stardate          ";INT(t*10)*0.1:GOTO 7260
  364. 6900 PRINT "  4 | 2   Condition         ";c$:GOTO 7260
  365. 6960 PRINT " 5--|--1  Quadrant          ";q1;",";q2:GOTO 7260
  366. 7020 PRINT "  6 | 8   Sector            ";s1;",";s2: GOTO 7260
  367. 7070 PRINT "    7     Photon Torpedoes  ";INT(p): GOTO 7260
  368. 7120 PRINT "   DIR    Total Energy      ";INT(e+s): GOTO 7260
  369. 7180 PRINT "          Shields           ";INT(s): GOTO 7260
  370. 7240 PRINT "          Klingons Remaining";INT(k9)
  371. 7260 NEXT i :PRINT o1$: RETURN
  372.  
  373.   'Library Computer Code
  374.     
  375. 7290 IF d(8)<0 THEN PRINT "  Computer disabled": GOTO 1990
  376.  
  377.  
  378. 7330 PRINT "  Functions available from Library-Computer:"
  379.       PRINT "     1 = Cumulative Galactic Record"
  380.       PRINT "     2 = Status Report"
  381.       PRINT "     3 = Photon Torpedo Data
  382.       PRINT "     4 = Starbase Navigation Data
  383.       PRINT "     5  = Direction/Distance Calculator
  384.       PRINT "     6 = Galaxy `Region Name' Map":PRINT
  385.    
  386. 7340 h8=1:INPUT" Computer active and awaiting command";a :IF a<0 THEN 1990 :a=a+1
  387.  
  388. 7350 ON a GOTO 7544,7900,8070,8500,8150,7400 
  389.  
  390.      'Setup to change Cumulative Galactic Record to Galaxy Map 
  391.    
  392. 7400 h8=0: g5=1: PRINT "                        The Galaxy": GOTO 7550
  393.  
  394.     'Cumulative Galactic Record
  395.  7540:   
  396. 7544 PRINT "  Computer Record of Galaxy for Quadrant";q1;",";q2
  397.    PRINT 
  398. 7550 PRINT "         1     2     3     4     5     6     7     8 
  399.        o1$="       ----- ----- ----- ----- ----- ----- ----- -----
  400.    PRINT o1$: FOR i = 1 TO 8:PRINT i;: IF h8=0 THEN 7740
  401.    FOR j=1 TO 8: PRINT "   ";:IF z(i,j)=0 THEN PRINT "***";:GOTO 7720
  402.     PRINT RIGHT$(STR$(z(i,j)+1000),3);
  403. 7720 NEXT j: GOTO 7850
  404. 7740 z4=i: z5=1: GOSUB 9030: j0=INT(15-0.5*LEN(g2$)):PRINT  TAB(j0);g2$; 
  405.    z5=5: GOSUB 9030: j0=INT(39-0.5* LEN(g2$)): PRINT TAB(j0);g2$;
  406. 7850 PRINT :PRINT o1$:NEXT i: GOTO 1990 'some pokes left out***
  407.    
  408.  'Status Report
  409.  
  410. 7900 PRINT "   Status Report:":x$="": IF k9>1 THEN x$= "s"
  411.      PRINT "Klingon";x$;" Left: ";k9
  412.      PRINT "Mission must be completed in";0.1*INT((t0+t9-t)*10);"Stardates"
  413.       x$="s": IF b9<2 THEN x$ ="": IF b9<1 THEN 8010
  414.       PRINT "The Federation is maintaining";b9;"Starbase";x$;" in the Galaxy"
  415.       
  416.    GOTO 5690
  417.      GOSUB sayfour 
  418. 8010 PRINT "  Your stupidity has left you on your own in"
  419.      PRINT " the Galaxy -- You have no Starbases left!" :GOTO 5690
  420.      
  421.    ' Torpedo, Base Navigation, Distance/Direction Calculator...  
  422.  
  423. 8050 FNd(i)=INT(FNd(i)*100000)/100000
  424. 8070 IF k3<=0 THEN 4270
  425.      x$="": IF k3>1 THEN x$="s"
  426.     PRINT " From Enterprise to Klingon Battle Cruiser";x$
  427.     h8=0:FOR i=1 TO 3: IF k(i,3)<=0 THEN 8480
  428.     w1=k(i,1): x=k(i,2)
  429. 8120 c1=s1:a=s2: GOTO 8220
  430.      
  431. 8150 PRINT " Direction/Distance Calculator:"
  432.     PRINT " You are at Quadrant ";q1;",";q2;" Sector ";s1;",";s2
  433.     PRINT "Please enter":INPUT"  Initial Coordinates (x,y)";c1,a
  434.     INPUT"  Final Coordinates (x,y)";w1,x
  435.     
  436.  
  437. 8220 x=x-a: a=c1-w1: IF x<0 THEN 8350
  438.     IF a<0 THEN 8410
  439.     IF x>0 THEN 8280
  440.     IF a=0 THEN c1=5: GOTO 8290
  441. 8280 c1=1 
  442. 8290 IF ABS(a)<=ABS(x) THEN 8330
  443. 8310 PRINT " Direction =";c1+(((ABS(a)-ABS(x))+ABS(a))/ABS(a)):GOTO 8460
  444. 8330 PRINT " Direction =";c1+(ABS(a)/ABS(x)): GOTO 8460
  445.  
  446. 8350 IF a>0 THEN c1=3: GOTO 8420
  447. 8360 IF x<>0 THEN c1=5: GOTO 8290
  448. 8410 c1=7
  449. 8420 IF ABS(a) >=ABS(x) THEN 8450
  450. 8450 PRINT " Direction =";c1+(((ABS(x)-ABS(a))+ABS(x))/ABS(x)): GOTO 8460
  451. 8460 PRINT " Distance =";SQR(x^2+a^2): IF h8=1 THEN 1990
  452. 8480 NEXT i: GOTO 1990
  453. 8500 IF b3<>0 THEN PRINT " From Enterprise to Starbase:":w1=b4:x=b5: GOTO 8120
  454.    PRINT " Mr. Spock reports:   `Sensors show no Starbases in this ";
  455.    PRINT "Quadrant.": GOTO 1990
  456.    
  457.  'Find Empty Place in Quadrant for Things  
  458.  
  459. 8590 r1=FNr(1): r2=FNr(1): a$="   ": z1=r1: z2=r2: GOSUB 8830: IF z3=0 THEN 8590
  460. 8600 RETURN
  461.   
  462.   'Insert in String Array for Quadrant
  463.   
  464. 8670 s8=INT(z2-0.5)*3+INT(z1-0.5)*24+1
  465.      IF LEN(a$)<>3 THEN PRINT "ERROR": STOP
  466.      IF s8=1 THEN q$=a$+RIGHT$(q$,189): RETURN
  467.      IF s8=190 THEN q$=LEFT$(q$,189)+a$:RETURN
  468.      
  469. 8700 q$ = LEFT$(q$,s8-1) + a$ + RIGHT$(q$,190-s8):RETURN
  470.   
  471.   'Prints Device Name
  472.       
  473.  
  474. 8790 ON r1 GOTO 8792,8794,8796,8798,8800,8802,8804,8806
  475.  
  476. 8792 g2$= "Warp Engines": RETURN
  477. 8794 g2$= "Short Range Sensors":RETURN
  478. 8796 g2$= "Long Range Sensors":RETURN
  479. 8798 g2$= "Phaser Control":RETURN
  480. 8800 g2$= "Photon Tubes": RETURN
  481. 8802 g2$= "Damage Control": RETURN
  482. 8804 g2$= "Shield Control": RETURN
  483. 8806 g2$= "Library-Computer":RETURN
  484.  
  485.    'String Comparison in Quadrant Array
  486.    
  487. 8830 z1=INT(z1+0.5): z2=INT(z2+0.5): s8=(z2-1)*3+(z1-1)*24+1: z3=0
  488.    IF MID$(q$,s8,3)<>a$ THEN RETURN
  489.    z3=1:RETURN
  490.  
  491.  'Quadrant name in g2$ from z4,z5 (=q1,q2)
  492.  'Call with g5=1 to get region name only
  493.  
  494. 9030 IF z5<=4 THEN ON z4 GOTO 9040,9050,9060,9070,9080,9090,9100,9110
  495.    GOTO 9120
  496.     
  497. 9040 g2$ ="Antares":GOTO 9210
  498. 9050 g2$ ="Rigel":GOTO 9210
  499. 9060 g2$ ="Procyon":GOTO 9210
  500. 9070 g2$ ="Vega": GOTO 9210
  501. 9080 g2$ ="Canopus": GOTO 9210
  502. 9090 g2$ ="Altair" : GOTO 9210
  503. 9100 g2$ ="Sagittarius": GOTO 9210
  504. 9110 g2$ ="Pollux": GOTO 9210
  505.     
  506. 9120 ON z4 GOTO 9130,9140,9150,9160,9170,9180,9190,9200
  507.  
  508. 9130 g2$="Sirius":GOTO 9210
  509. 9140 g2$="Deneb":GOTO 9210
  510. 9150 g2$="Capella":GOTO 9210
  511. 9160 g2$="Betelgeuse":GOTO 9210
  512. 9170 g2$="Aldebaran":GOTO 9210
  513. 9180 g2$="Regulus": GOTO 9210
  514. 9190 g2$="Arcturus": GOTO 9210
  515. 9200 g2$="Spica":GOTO 9210
  516.  
  517. 9210 IF g5<>1 THEN ON z5 GOTO 9230,9240,9250,9260,9230,9240,9250,9260
  518.  
  519. 9220 RETURN
  520.  
  521. 9230 g2$=g2$+" I":RETURN
  522. 9240 g2$=g2$+" II":RETURN
  523. 9250 g2$=g2$+" III":RETURN
  524. 9260 g2$=g2$+" IV":RETURN
  525.  
  526. speech:
  527.  
  528. FOR Count = 0 TO 8
  529.   READ FemNat% (Count)
  530.  NEXT Count
  531.  
  532. FOR Count = 0 TO 8
  533.   READ MaleNat% (Count)
  534.  NEXT Count
  535.  
  536. DATA 185,0,155,1,24000,55,5,0,0
  537. DATA 90,0,165,0,20000,64,5,0,0 
  538.  
  539. FOR Count = 0 TO 9
  540.    READ t$(Count)
  541.   NEXT Count
  542.   
  543.  DATA "Read your orders carefully."
  544.  DATA "The Federation ihz in need of a new Star ship Commander. Ihz anyone interested?"
  545.  DATA "If there ihz, let him step forward, and enter eye!"
  546.  DATA "Your stewpidity has left you stranded in the Galaxy. You have no Star bases left!"
  547.  DATA  "Congratulations Kaptin! The last Klingon battle crooser menacing the federation"
  548.  DATA "has been dehstroyed."
  549.  DATA "The Enterprise has been destroyed. The Federation will be conkered."
  550.  DATA "That duz it Kaptin! You are herebuy relieved of your Command"
  551.  DATA "and sentenced to nyntee-nine star dates at hard labor on cygnus twelve."
  552.  DATA "Starfleet command ihz reviewing your wreckord to consihder Court Marshall."
  553.     
  554. RETURN
  555.  
  556. sayone:
  557. SAY TRANSLATE$ (t$(0)) ,MaleNat%
  558. RETURN
  559.  
  560. saytwo:
  561. SAY TRANSLATE$ (t$(1)), MaleNat%
  562. SAY TRANSLATE$ (t$(2)), MaleNat%
  563. RETURN
  564.  
  565. saythree:
  566. SAY TRANSLATE$ (t$(4)), MaleNat%
  567. SAY TRANSLATE$ (t$(5)), MaleNat%
  568. RETURN
  569.  
  570. sayfour:
  571. SAY TRANSLATE$ (t$(3)), FemNat%
  572. RETURN
  573.  
  574.  sayfive:
  575. SAY TRANSLATE$ (t$(6)), FemNat%
  576. RETURN
  577.      
  578. saysix:
  579. SAY TRANSLATE$ (t$(7)), MaleNat%
  580. SAY TRANSLATE$ (t$(8)), MaleNat%
  581. RETURN
  582.  
  583. sayseven:
  584. SAY TRANSLATE$ (t$(9)), MaleNat%
  585. RETURN
  586.  
  587.   
  588.  
  589.  
  590.  
  591.  
  592.     
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.